package com.saturday.web.interceptor;

import com.github.pagehelper.PageHelper;
import com.saturday.common.support.UserContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.AsyncHandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Slf4j
public class ThreadLocalInterceptor implements AsyncHandlerInterceptor {

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        // TODO 清理当前线程中的信息
        UserContextHolder.clear();
        PageHelper.clearPage();
    }
}
